home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / pcscheme / geneva / sources.exe / SOURCES / INLINE / PEEK.ASM next >
Encoding:
Assembly Source File  |  1992-11-25  |  1.8 KB  |  89 lines

  1. ;* PEEK.ASM
  2. ;************************************************************************
  3. ;*                                    *
  4. ;*        PC Scheme/Geneva 4.00 Borland TASM code            *
  5. ;*                                    *
  6. ;* (c) 1985-1988 by Texas Instruments, Inc. See COPYRIGHT.TXT        *
  7. ;* (c) 1992 by L. Bartholdi & M. Vuilleumier, University of Geneva    *
  8. ;*                                    *
  9. ;*----------------------------------------------------------------------*
  10. ;*                                    *
  11. ;*        Direct memory peek & poke, hardware input/output    *
  12. ;*                                    *
  13. ;*----------------------------------------------------------------------*
  14. ;*                                    *
  15. ;* Created by: Larry Bartholdi        Date: 1992            *
  16. ;* Revision history:                            *
  17. ;* - 18 Jun 92:    Renaissance (Borland Compilers, ...)            *
  18. ;*                                    *
  19. ;*                    ``In nomine omnipotentii dei''    *
  20. ;************************************************************************
  21. IDEAL
  22. INCLUDE "inline.ash"
  23. startinline    PEEKBYTE, 1
  24.     lea    ax, [reg1]
  25.     call    int2long C, ax
  26.     mov    cl, 0ch
  27.     shl    dx, cl
  28.     jnc    @@noA20
  29.     mov    dx, 0ffffh
  30.     add    ax, 10h
  31. @@noA20:
  32.     mov    es, dx
  33.     mov    bx, ax
  34.     mov    al, [es:bx]
  35.     mov    ah, 0
  36.     cwd
  37.     lea    bx, [reg1]
  38.     call    long2int C, bx, ax, dx
  39.     ret
  40. endinline
  41. startinline    POKEBYTE, 2
  42.     lea    ax, [reg2]
  43.     call    int2long C, ax
  44.     push    ax
  45.     lea    ax, [reg1]
  46.     call    int2long C, ax
  47.     mov    cl, 0ch
  48.     shl    dx, cl
  49.     jnc    @@noA20
  50.     mov    dx, 0ffffh
  51.     add    ax, 10h
  52. @@noA20:
  53.     mov    es, dx
  54.     mov    bx, ax
  55.     pop    ax
  56.     xchg    al, [es:bx]
  57.     mov    ah, 0
  58.     cwd
  59.     lea    bx, [reg1]
  60.     call    long2int C, bx, ax, dx
  61.     ret
  62. endinline
  63. startinline    INBYTE, 1
  64.     mov    dx, [reg1.disp]
  65.     in    al, dx
  66.     mov    ah, 0
  67.     mov    [reg1.disp], ax
  68.     ret
  69. endinline
  70. startinline    INWORD, 1
  71.     mov    dx, [reg1.disp]
  72.     in    ax, dx
  73.     mov    [reg1.disp], ax
  74.     ret
  75. endinline
  76. startinline    OUTBYTE, 2
  77.     mov    dx, [reg1.disp]
  78.     mov    al, [BYTE reg2.disp]
  79.     out    dx, al
  80.     ret
  81. endinline
  82. startinline    OUTWORD, 2
  83.     mov    dx, [reg1.disp]
  84.     mov    ax, [reg2.disp]
  85.     out    dx, ax
  86.     ret
  87. endinline
  88. END
  89.